#include "stdio.h"
#define N 5
#include "stdlib.h"
struct Node{
    int data;
    struct Node* next;
};
void initList(struct Node* node){
    node->data = -1;
    node->next = NULL;
};
void InsertByHead(int data,struct Node* list){
    struct Node* node = (struct Node*)malloc(sizeof(struct Node));
    node->data = data;
    node->next = list->next;
    list->next = node;
}
void InsertByTail(int data,struct Node* list){
    struct Node* node = (struct Node*)malloc(sizeof(struct Node));
    node->data = data;
    node->next = NULL;

    struct Node* p = list;
    while (p->next != NULL){
        p = p->next;
    }
    p->next = node;
}
void deleteList(struct Node* list,int index){
    struct Node* p = list;
    // index = 3
    for(int i = 0; i < index - 1;i++){
        p = p->next;
    }
    struct Node* node = p->next;
    p->next = p->next->next;
    free(node);
}
int main(){
    struct Node list;
    initList(&list);
    Insert(1,&list);
    Insert(2,&list);
    Insert(3,&list);
    Insert(4,&list);
    printf("");
//    struct Node node1;
//    node1.data = 56;
//
//    struct Node node2;
//    node2.data = 78;
//
//    node1.next = &node2;
//    printf("%d\t%d",node1.data,(*node1.next).data);
    return 0;
}
